﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ChipsMove : MonoBehaviour {

    public Vector3 destination;
    private float distance;
    private Vector3 direction;
    //public bool isStop;
	void Start () {
        direction = (destination - transform.localPosition).normalized;
	}
	

	void Update () {       
        //transform.position = Vector3.Lerp(transform.position, destination, Time.deltaTime);
        //Debug.Log("update" + destination);
        
        
        //distance = Vector3.Distance(transform.localPosition, destination);
        //if (distance > 15f)
        //{
        //    transform.Translate(direction * Time.deltaTime * 3);
        //}

        transform.localPosition = Vector3.MoveTowards(transform.localPosition,destination, 30);    
	}

    public void setDestination(Vector3 pos)
    {
        destination = pos;
    }
}
